<?php  defined('BASEPATH') OR exit('No direct script access allowed');
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/8/9
 * Time: 17:00
 */

if(!function_exists('alert_and_redirect')){

    /**
     * alert_and_redirect
     *
     * 生成alert提醒并跳转到指定地址的html
     *
     * @param string $message alert信息
     * @param string $url_suf 跳转地址后缀
     */
    function alert_and_redirect($message='', $url_suf=''){
        if($url_suf === ''){
            $url_suf = base_url();
        }

        echo "<script type='text/javascript'>
              alert('$message');
              window.location.href='".site_url($url_suf)."';
              </script>";
        exit;
    }

}